package asteroids.model.programs.parsing.expressions;

import java.util.Map;

import asteroids.model.CollisionObject;

public class DoubleLiteral extends BasicExpression {
	public DoubleLiteral(double value){
		if(!canHaveAsValue(value)){
			throw new IllegalArgumentException("That is an invalid value");
		}
		this.value = value;
	}
	
	double value;
	public boolean canHaveAsValue(double value){
		return(getValue() != Double.NEGATIVE_INFINITY && getValue() != Double.POSITIVE_INFINITY );
	}
	@Override
	public Object getContent(Map<String,E> map, CollisionObject givenCollisionObject) {
		return value;
	}
	public double getValue(){
		return this.value;
	}
	@Override
	public boolean isDouble() {
		return true;
	}
	public boolean isBoolean(){
		return false;
	}
	public boolean isEntity(){
		return false;
	}
	public boolean isString(){
		return false;
	}
}
